$(document).ready(function() {
    $("#reg-form").validate({
		rules: {
			r_login: {
				required: true,
				email: true
			},
			r_password: {
				required: true,
				minlength: 8
			},
			r_cpassword: {
				required: true,
				minlength: 8,
				equalTo: "#r_password"
			},
			r_username: {
				required: true,
				minlength: 4
			},
			r_surname: {
				required: true,
				minlength: 4
			},
			r_phone: {
				digits: true,
				minlength: 3,
				maxlength: 14
			}
		},
		messages: {
			r_login: "Provide a valid e-mail address, please",
			r_password: {
				required: "Enter your password, please",
				minlength: "Password should be at least 8 characters long"
			},
			r_cpassword: {
				required: "Enter your password, please",
				minlength: "Password should be at least 8 characters long",
				equalTo: "Please, enter the same password as above"
			},
			r_username: {
				required: "Enter your first name, please",
				minlength: "Your name should be at least 4 characters long"
			},
			r_surname: {
				required: "Enter your last name, please",
				minlength: "Your name should be at least 4 characters long"
			},
			r_phone: {
				digits: "Remove non-digit symbols, please",
				minlength: "Number should be 3-14 characters long",
				maxlength: "Number should be 3-14 characters long"
			}
		}
	});
});